﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.3.58    贷后检查信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_COL_CHECKINFO: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_COL_CHECKINFO()
		{}
		#region Model
		private long _id;
		private long _loanid;
		private long _proid;
		private long _conid;
		private decimal _leftamt;
		private string _checkmod;
		private string _checkby1;
		private string _checkby2;
		private Nullable<DateTime> _startdate;
		private Nullable<DateTime> _enddate;
		private Nullable<DateTime> _createdate;
		private string _risklevel;
		private string _checkcontent;
		private string _loanfor;
		private string _paysource;
		private string _custbuss;
		private string _custmanage;
		private string _custfin;
		private string _assure;
		private string _pledge;
		private string _otherinfo;
		private int _status;
		private string _confirmby;
		private Nullable<DateTime> _confirmdate;
		/// <summary>
		/// 记录ID唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 放款记录IDTb_Loan_Main.ID
		/// </summary>
		[DataMember]
		public long LOANID
		{
			get{return _loanid;}
			set{
				if ( _loanid!= value)
				{
					 _loanid = value;
					OnPropertyChanged("LOANID");
				}
			}
		}
		/// <summary>
		/// 立项申请记录ID
		/// </summary>
		[DataMember]
		public long PROID
		{
			get{return _proid;}
			set{
				if ( _proid!= value)
				{
					 _proid = value;
					OnPropertyChanged("PROID");
				}
			}
		}
		/// <summary>
		/// 合同记录ID
		/// </summary>
		[DataMember]
		public long CONID
		{
			get{return _conid;}
			set{
				if ( _conid!= value)
				{
					 _conid = value;
					OnPropertyChanged("CONID");
				}
			}
		}
		/// <summary>
		/// 结欠本金合计
		/// </summary>
		[DataMember]
		public decimal LEFTAMT
		{
			get{return _leftamt;}
			set{
				if ( _leftamt!= value)
				{
					 _leftamt = value;
					OnPropertyChanged("LEFTAMT");
				}
			}
		}
		/// <summary>
		/// 检查方式
		/// </summary>
		[DataMember]
		public string CHECKMOD
		{
			get{return _checkmod;}
			set{
				if ( _checkmod!= value)
				{
					 _checkmod = value;
					OnPropertyChanged("CHECKMOD");
				}
			}
		}
		/// <summary>
		/// 检查人1
		/// </summary>
		[DataMember]
		public string CHECKBY1
		{
			get{return _checkby1;}
			set{
				if ( _checkby1!= value)
				{
					 _checkby1 = value;
					OnPropertyChanged("CHECKBY1");
				}
			}
		}
		/// <summary>
		/// 检查人2
		/// </summary>
		[DataMember]
		public string CHECKBY2
		{
			get{return _checkby2;}
			set{
				if ( _checkby2!= value)
				{
					 _checkby2 = value;
					OnPropertyChanged("CHECKBY2");
				}
			}
		}
		/// <summary>
		/// 检查开始时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> STARTDATE
		{
			get{return _startdate;}
			set{
				if ( _startdate!= value)
				{
					 _startdate = value;
					OnPropertyChanged("STARTDATE");
				}
			}
		}
		/// <summary>
		/// 检查结束时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> ENDDATE
		{
			get{return _enddate;}
			set{
				if ( _enddate!= value)
				{
					 _enddate = value;
					OnPropertyChanged("ENDDATE");
				}
			}
		}
		/// <summary>
		/// 记录时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> CREATEDATE
		{
			get{return _createdate;}
			set{
				if ( _createdate!= value)
				{
					 _createdate = value;
					OnPropertyChanged("CREATEDATE");
				}
			}
		}
		/// <summary>
		/// 风险级别
		/// </summary>
		[DataMember]
		public string RISKLEVEL
		{
			get{return _risklevel;}
			set{
				if ( _risklevel!= value)
				{
					 _risklevel = value;
					OnPropertyChanged("RISKLEVEL");
				}
			}
		}
		/// <summary>
		/// 检查事项说明栏
		/// </summary>
		[DataMember]
		public string CHECKCONTENT
		{
			get{return _checkcontent;}
			set{
				if ( _checkcontent!= value)
				{
					 _checkcontent = value;
					OnPropertyChanged("CHECKCONTENT");
				}
			}
		}
		/// <summary>
		/// 贷款用途
		/// </summary>
		[DataMember]
		public string LOANFOR
		{
			get{return _loanfor;}
			set{
				if ( _loanfor!= value)
				{
					 _loanfor = value;
					OnPropertyChanged("LOANFOR");
				}
			}
		}
		/// <summary>
		/// 还款来源
		/// </summary>
		[DataMember]
		public string PAYSOURCE
		{
			get{return _paysource;}
			set{
				if ( _paysource!= value)
				{
					 _paysource = value;
					OnPropertyChanged("PAYSOURCE");
				}
			}
		}
		/// <summary>
		/// 客户经营情况
		/// </summary>
		[DataMember]
		public string CUSTBUSS
		{
			get{return _custbuss;}
			set{
				if ( _custbuss!= value)
				{
					 _custbuss = value;
					OnPropertyChanged("CUSTBUSS");
				}
			}
		}
		/// <summary>
		/// 客户管理情况
		/// </summary>
		[DataMember]
		public string CUSTMANAGE
		{
			get{return _custmanage;}
			set{
				if ( _custmanage!= value)
				{
					 _custmanage = value;
					OnPropertyChanged("CUSTMANAGE");
				}
			}
		}
		/// <summary>
		/// 客户财务情况
		/// </summary>
		[DataMember]
		public string CUSTFIN
		{
			get{return _custfin;}
			set{
				if ( _custfin!= value)
				{
					 _custfin = value;
					OnPropertyChanged("CUSTFIN");
				}
			}
		}
		/// <summary>
		/// 担保人情况
		/// </summary>
		[DataMember]
		public string ASSURE
		{
			get{return _assure;}
			set{
				if ( _assure!= value)
				{
					 _assure = value;
					OnPropertyChanged("ASSURE");
				}
			}
		}
		/// <summary>
		/// 抵/质押物情况
		/// </summary>
		[DataMember]
		public string PLEDGE
		{
			get{return _pledge;}
			set{
				if ( _pledge!= value)
				{
					 _pledge = value;
					OnPropertyChanged("PLEDGE");
				}
			}
		}
		/// <summary>
		/// 其他
		/// </summary>
		[DataMember]
		public string OTHERINFO
		{
			get{return _otherinfo;}
			set{
				if ( _otherinfo!= value)
				{
					 _otherinfo = value;
					OnPropertyChanged("OTHERINFO");
				}
			}
		}
		/// <summary>
		/// 状态0保存，1确认
		/// </summary>
		[DataMember]
		public int STATUS
		{
			get{return _status;}
			set{
				if ( _status!= value)
				{
					 _status = value;
					OnPropertyChanged("STATUS");
				}
			}
		}
		/// <summary>
		/// 确认人
		/// </summary>
		[DataMember]
		public string CONFIRMBY
		{
			get{return _confirmby;}
			set{
				if ( _confirmby!= value)
				{
					 _confirmby = value;
					OnPropertyChanged("CONFIRMBY");
				}
			}
		}
		/// <summary>
		/// 确认时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> CONFIRMDATE
		{
			get{return _confirmdate;}
			set{
				if ( _confirmdate!= value)
				{
					 _confirmdate = value;
					OnPropertyChanged("CONFIRMDATE");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

